<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>upload file1</title>
<script type="text/javascript" src="../js/jquery2.js"></script>
<script type="text/javascript" src="../js/ajaxfileupload.js"></script>
</head>
<body>
	<!--<img id="loading" src="style/images/loading.gif" style="display:none;">
	--><input type="file" id="fileToUpload" name="fileToUpload"/>
	<INPUT type="button" value="上传文件" onclick="return ajaxFileUpload();"/><span id="msg"></span>

</body>


<script type="text/javascript">
function ajaxFileUpload()
	{
/*		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});*/

		$.ajaxFileUpload
		(
			{
				url:'../upload!ifame.action',
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'html',
				beforeSend:function()
				{
					$("#loading").show();
				},
				complete:function()
				{
					$("#loading").hide();
				},				
				success: function (data, status)
				{
				alert("abcd");
					if(typeof(data.error) != 'undefined')
					{
					if(data.error != '')
						{
							alert(data.error);
						}else
						{
							alert(data.msg);
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		);
		
		return false;

	}

</script>
</html>